package main

func main() {

	//strsArray := []string{"a", "b", "c"}
	//str := "sssssss"

	//测试用例
	nums := []int{0, 0, 1, 1, 1, 2, 2, 3, 3, 4}

	//打印测试用例返回结果
	resp := removeDuplicates(nums)
	println(resp)
	for _, v := range nums {
		println(v)
	}

}

//传地址
func removeDuplicates(nums []int) int {
	lenNums := len(nums)
	for i := 0; i < lenNums-1; i++ {
		if nums[i] == nums[i+1] {
			nums = append(nums[:i], nums[i+1:]...) //...为可变参数，可以接受任意长度的参数
			lenNums--
			i--
		}
	}
	return len(nums)
}
